using System.Data;
using Oracle.DataAccess.Client;
using Oracle.DataAccess.Types;
using System;

namespace IP.Core.IPBusinessService
{
	/// <summary>
	/// lam cac viec lien quan den parameter khi dung toi tham so
	/// </summary>
	public class DBParamUtil
	{
		public DBParamUtil()
		{
			//
			// TODO: Add constructor logic here
			//
		}
		public static OracleParameter  getDecimalInputParam(string ip_name ,decimal ip_value) 
		{
			OracleParameter v_oraclePara = new OracleParameter();
			v_oraclePara.OracleDbType = OracleDbType.Decimal;
			v_oraclePara.Direction = ParameterDirection.Input;
			v_oraclePara.Value = ip_value;
			v_oraclePara.ParameterName = ip_name;
			return v_oraclePara;
		}
		public static OracleParameter  getDecimalOutputParam(string ip_name ,decimal ip_value) 
		{
			OracleParameter v_oraclePara = new OracleParameter();
			v_oraclePara.OracleDbType = OracleDbType.Decimal;
			v_oraclePara.Direction = ParameterDirection.Output;
			v_oraclePara.Value = ip_value;
			v_oraclePara.ParameterName = ip_name;
			return v_oraclePara;
		}
		public static OracleParameter  getVarcharInputParam(string ip_name ,string ip_value) 
		{
			OracleParameter v_oraclePara = new OracleParameter();
			v_oraclePara.OracleDbType = OracleDbType.Varchar2;
			v_oraclePara.Direction = ParameterDirection.Input;
			v_oraclePara.Value = ip_value;
			v_oraclePara.ParameterName = ip_name;
			return v_oraclePara;
		}
		public static OracleParameter  getVarcharOutputParam(string ip_name ,string ip_value) 
		{
			OracleParameter v_oraclePara = new OracleParameter();
			v_oraclePara.OracleDbType = OracleDbType.Varchar2;;
			v_oraclePara.Direction = ParameterDirection.Output;
			v_oraclePara.Value = ip_value;
			v_oraclePara.ParameterName = ip_name;
			return v_oraclePara;
		}
		public static OracleParameter  getDateInputParam(string ip_name ,DateTime ip_value) 
		{
			OracleParameter v_oraclePara = new OracleParameter();
			v_oraclePara.OracleDbType = OracleDbType.Date;
			v_oraclePara.Direction = ParameterDirection.Input;
			v_oraclePara.Value = ip_value;
			v_oraclePara.ParameterName = ip_name;
			return v_oraclePara;
		}
		public static OracleParameter  getDateOutputParam(string ip_name ,DateTime ip_value) 
		{
			OracleParameter v_oraclePara = new OracleParameter();
			v_oraclePara.OracleDbType = OracleDbType.Date;
			v_oraclePara.Direction = ParameterDirection.Output;
			v_oraclePara.Value = ip_value;
			v_oraclePara.ParameterName = ip_name;
			return v_oraclePara;
			
		}
	}

}





